<?php
	include_once("cmsConfig.php");

	
?>
<div id="contentIndex">     
<div class="cmsFormSwitchBoard">
<form id="cmsFormSwitchBoard" class="cmsFormSwitchBoard" name="cmsFormSwitchBoard" method="post" action="<?= $_SERVER['PHP_SELF'] ?>?fileNo=6" >
<table class="cmsFormSwitchBoard">
<tr>
<th>Id</th><th>Name</th><th>content</th><th>sidebar</th><th>enabled</th><th>&nbsp;</th>
<th align="left"><pre>
<? print <<< EOD
USER\tGROUP\tALL
PDAEV\tPDAEV\tPDAEV
EOD;
?></pre></th>
</tr>
<?php


	$formDescriptorTableWriter->resetIterator();
	while ($row = $formDescriptorTableWriter->nextItem()) {
		$baseName= "formDescriptor[" . $row->formid . "]";
		$id = "formDescriptor_" . $row->formid;
?>
<tr>
<td><?= $row->formid ?></td>
<td> <?= $row->formname  ?> </td>
<td><input name="<?= $baseName ?>[contentmodule]" id="<?= $id ?>" value="1" type="checkbox" <?  if ( $row->contentmodule) echo "checked"; ?> /></td>
<td><input name="<?= $baseName ?>[sidebarmodule]" id="<?= $id ?>" value="1" type="checkbox" <?  if ( $row->sidebarmodule) echo "checked"; ?> /></td>
<td><input name="<?= $baseName ?>[activemodule]" id="<?= $id ?>" value="1" type="checkbox" <?  if ( $row->activemodule) echo "checked"; ?> /></td>
<td><a target="_blank" href="/cms/html/Admin/cmsFormEditor.php?formid=<?= $row->formid ?>" >EDIT</a></td>
<td align="left"><pre><?	
	foreach (array ( PERMISSION_USER, PERMISSION_GROUP, PERMISSION_ALL) as $mask ) {
		for ($p = 4; $p >= 0 ; $p--) {
			echo (( pow(2, $p) << $mask) & (  $row-> permission ) ? "X" : "-" );
		}
	echo "\t";
	}
	echo "\t" .  $row->uid . "\t" . $row->gid;
?></pre>
</td>
</tr>
<?php
	}
?>
</table>
<input type="submit" name="save" value="save changes"/>
</form>
<table class="cmsFormSwitchBoard">
<tr>
<td>
<a href="/cms/html/Admin/cmsFormEditor.php?generateNew=true&formid=-1">Add new Form</a>
</td>
</tr>
</table>
</div>
</div>